package com.ucode.model.cgms.enums;

import cn.hutool.core.util.ArrayUtil;
import com.ucode.tool.base.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 支付类型
 *
 * @author ll
 */
@AllArgsConstructor
@Getter
public enum CgmsPayTypeEnum implements IntArrayValuable {

    WECHAT_APY(2, "微信支付"),
    ;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CgmsPayTypeEnum::getType).toArray();

    public static CgmsPayTypeEnum get(Integer code) {
        return ArrayUtil.firstMatch(o -> o.getType().equals(code), values());
    }
    /**
     * 类型
     */
    private final Integer type;
    /**
     * 名称
     */
    private final String message;

    public Integer getCode() {
        return type;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }

}
